package com.his.server.utils.dao;

import java.util.HashMap;

import org.apache.commons.lang.xwork.StringUtils;

import com.his.server.exception.DAOException;
import com.his.server.utils.main.EnvironmentProperties;

public class DAOFactory {
	
	private static HashMap daoMap = null;
	
	public static Object getDao(Class daoiface) throws DAOException {
		
		inital();
		
		Object obj = daoMap.get(daoiface);
		
		if (obj == null) {
			throw new DAOException("No interface found");
		}
		
		return obj;
	}
	
	public static synchronized void inital() {
				
		if (daoMap == null) {
			daoMap = DAOConfig.Load();
		}
		
	}
}